﻿// Copyright (c) MichaConrad. All rights reserved. See License.txt in the project root for license information.

namespace LinqToLdapExtensions.Scope
{
    using LinqToLdap;

    /// <summary>
    /// Extends the contract defined by <see cref="ICurrentDirectoryContext"/>
    /// by providing methods to bind and unbind <see cref="IDirectoryContext"/> to the current scope.
    /// </summary>
    public interface ICurrentDirectoryContextBinding : ICurrentDirectoryContext
    {
        /// <summary>
        /// Binds the <see cref="LinqToLdap.IDirectoryContext"/> to the <see cref="CurrentDirectoryContext"/>.
        /// </summary>
        /// <param name="context">
        /// The <see cref="LinqToLdap.IDirectoryContext"/> which should be bound to the scope.
        /// </param>
        void Bind(IDirectoryContext context);

        /// <summary>
        /// Unbinds the <see cref="LinqToLdap.IDirectoryContext"/> from the <see cref="CurrentDirectoryContext"/> scope.
        /// </summary>
        /// <returns>
        /// The <see cref="IDirectoryContext"/> which was bound.
        /// </returns>
        IDirectoryContext Unbind();

        /// <summary>
        /// Returns whether there is a <see cref="LinqToLdap.IDirectoryContext"/> bound to the <see cref="CurrentDirectoryContext"/>.
        /// </summary>
        /// <returns>
        /// <c>True</c> whether there is a <see cref="LinqToLdap.IDirectoryContext"/> 
        /// bound to the <see cref="CurrentDirectoryContext"/>, otherwise <c>False</c>.
        /// </returns>
        bool HasBind();
    }
}